import Api from '@/api/system/roles'
import i18n from "@/lang/index";
const modalConfig = {
  pageName: 'sys:user',
  dialog: {
    title: i18n.global.t("title.7"),
    width: 800,
    appendToBody: true,
    draggable: true,
    labelWidth: "auto",
  },
  formAction: (data) => {
    console.log('edit', data)
    return new Promise((resolve, reject) => {
      Api.put(data).then((s) => {
        console.log(s)
        resolve(s)
      }).catch((e) => {
        reject(e)
      })
    })
  },
  formItems: [
    {
      type: "input",
      label: "ID",
      prop: "id",
      attrs: {
        disabled: true
      },
    },
    {
      type: "input",
      label: i18n.global.t("form.34"),
      prop: "name",
      attrs: {
        placeholder: i18n.global.t("hint.59"),
      },
    },
    {
      type: "custom",
      label: i18n.global.t("form.51"),
      prop: "permissions",
      attrs: {
        placeholder: i18n.global.t("hint.74"),
      },
    }, {
      type: "input",
      label: i18n.global.t("label.80"),
      prop: "title",
      attrs: {
        placeholder: i18n.global.t("hint.82"),
      },
    },
    {
      type: "input",
      label: i18n.global.t("label.81"),
      prop: "description",
      attrs: {
        placeholder: i18n.global.t("hint.83"),
      },
    }, {
      type: "select",
      label: i18n.global.t("form.48"),
      prop: "status",
      attrs: {
        multiple: false,
      },
      options: [
        { label: i18n.global.t("status.27"), value: "active" },
        { label: i18n.global.t("status.46"), value: "inactive" },
        { label: i18n.global.t("status.28"), value: "banned" },
      ],
      initialValue: "active",
    },
  ],
  formRules: {
    name: [{ required: true, message: i18n.global.t("hint.59"), trigger: "blur" }],
    title: [{ required: true, message: i18n.global.t("hint.82"), trigger: "blur" }],
    status: [{ required: true, trigger: "blur" }],
  },
}

export default modalConfig
